<template>
  <ul class="todo-list">
    <!-- completed: 完成的类名 -->
    <li :class="{completed:item.isDone}" v-for="item in list" :key="item.id">
      <div class="view">
        <input class="toggle"  type="checkbox" :checked="item.isDone" @change="change(item.id)" />
        <label>{{item.name}}</label>
        <button class="destroy" @click="delFn(item.id)" ></button>
      </div>
    </li>
  </ul>
  
</template>

<script>
export default {
 props:{
  list:{
    type:Array,
    required:true,
  }
 },
 methods:{
  delFn(id){
this.$emit('del',id)
  },
  change(id){
this.$emit('change',id)
  }
 }
}
</script>